<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>实名认证 - 用户中心</title>

   {include file="public/css"}
   {include file="public/js"}
</head>
<body>

{include file="public/header"}

<div class="layui-container fly-marginTop fly-user-main">
<div class="user-left-menu" >
{include file="public/left_menu"}
</div>


<div class="fly-panel fly-panel-user user-right-content" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li class="layui-this">
          实名认证
        </li>
      </ul>
      <div class="layui-tab-content"  style="padding: 20px 0;">

        {if $step == 1}
      <ul class="realname-list">
          <li><div class="layui-input-inline realname-icon"><i class="iconfont  iconshimingzhi"></i></div><div class="layui-input-inline realname-name"><p><strong>个人实名</strong></p><p>点击立即认证，完成个人认证</p></div><div class="layui-input-inline"><a href="{:url('user/validate/realname',['step'=>'2','type'=>1])}" class="layui-btn layui-btn-normal">立即认证</a></div></li>
          <li><div class="layui-input-inline realname-icon"><i class="iconfont  iconqi"></i></div><div class="layui-input-inline realname-name"><p><strong>企业实名</strong></p><p>点击立即认证，完成企业认证具有更高的可信度</p></div><div class="layui-input-inline"><a href="{:url('user/validate/realname',['step'=>'2','type'=>2])}" class="layui-btn layui-btn-normal">立即认证</a></div></li>
        </ul>

      {elseif $step==2}

      <form class="layui-form" action="" method="post">
          {:token()}

      {if $Request.param.type =='1'}
    
            <input type="hidden" name="type"  value="1" autocomplete="off" class="layui-input type">
            <div class="layui-form-item">
                <label class="layui-form-label realname-title" style="width:200px">真实姓名：</label>
                <div class="layui-input-inline">
                  <input type="text" name="realname"  placeholder="" autocomplete="off" class="layui-input realname">
                </div>
              </div>
       
      
            <div class="layui-form-item">
                <label class="layui-form-label card_number-title" style="width:200px">身份证号：</label>
                <div class="layui-input-inline">
                  <input type="text" name="card_number"  placeholder="" autocomplete="off" class="layui-input card_number">
                </div>
              </div>
      

     {elseif $Request.param.type =='2'}
  
        <!-- 企业认证 -->
    
        <input type="hidden" name="type"  value="2" autocomplete="off" class="layui-input type">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:200px">企业法人：</label>
            <div class="layui-input-inline">
              <input type="text" name="realname"  placeholder="" autocomplete="off" class="layui-input realname">
            </div>
          </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:200px">企业名称：</label>
            <div class="layui-input-inline">
              <input type="text" name="company"  placeholder="" autocomplete="off" class="layui-input company">
            </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label" style="width:200px">统一社会信用代码/注册号：</label>
              <div class="layui-input-inline">
                <input type="text" name="card_number"  maxlength="50" placeholder="" autocomplete="off" class="layui-input card_number">
              </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label" style="width:200px">营业执照：</label>
                <div class="layui-input-inline">
                    {upload:images name="thumb4" button_name="上传图片" type="3"}
                </div>
              </div>
    
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width:200px">营业执照期限：</label>
                    <div class="layui-input-inline" style="width:100px">
                      <input type="text" name="company_start_time" id="company_start_time"  placeholder="" autocomplete="off" class="layui-input company_start_time">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width:100px">
                      <input type="text" name="company_end_time" id="company_end_time" placeholder="" autocomplete="off" class="layui-input company_end_time">
                    </div>
                  </div> 
              
                     
  

     {/if}

        <div class="layui-form-item">
        <label class="layui-form-label" style="width:200px">身份证正面照：</label>
        <div class="layui-input-block">
        {upload:images name="thumb1" button_name="上传图片" type="3"}
        </div>
        </div>

        <div class="layui-form-item">
        <label class="layui-form-label" style="width:200px">身份证反面：</label>
        <div class="layui-input-block">
            {upload:images name="thumb2" button_name="上传图片" type="3"}
        </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label" style="width:200px">手持身份证照：</label>
          <div class="layui-input-block">
              {upload:images name="thumb3" button_name="上传图片" type="3"}
          </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width:200px">身份证有效时间：</label>
            <div class="layui-input-inline" style="width:100px">
              <input type="text" name="start_time"  id="start_time" placeholder="" autocomplete="off" class="layui-input start_time">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width:100px">
              <input type="text" name="end_time"  id="end_time" placeholder="" autocomplete="off" class="layui-input end_time">
            </div>
          </div> 
          <div class="layui-form-item">
                
            <div class="layui-input-block" style="margin-left:280px">
                <a class="layui-btn layui-btn-primary" href="javascript:history.go(-1)" >返回</a>
              <button class="layui-btn layui-btn-normal" lay-submit lay-filter="form1" >提交审核</button>
            
            </div>
          </div>
</form>    
      {elseif $step==3}
         <div class="audit-status">
           {if $realname['status'] ==0}
            <div><p><i class="fa fa-clock-o fa-5x" aria-hidden="true" style="color:#a1a1a1"></i></p><span>认证审核中...</span>
              <p class="layui-word-aux" style="margin-top:10px">
                  
                  {if $realname.type==1}
                  {if $realname.realname}真实姓名：{$realname.realname|}{/if}
                  {elseif   $realname.type==2}
                     {if $realname.realname}法人：{$realname.realname}{/if} &nbsp;
                     {if $realname.company}企业名称：{$realname.company}{/if} 
                  {/if}    
                 </p>
            </div>
           {elseif $realname['status'] ==1}
            <div>
                <p><p><i class="fa fa-check-circle fa-5x" aria-hidden="true" style="color:#33c633"></i></p> <span>恭喜您，实名认证成功！</span></p>
 
                <p class="layui-word-aux" style="margin-top:10px">
                  
                   {if $realname.type==1}
                   {if $realname.realname}真实姓名：{$realname.realname|}{/if}
                   {elseif   $realname.type==2}
                      {if $realname.realname}法人：{$realname.realname}{/if} &nbsp;
                      {if $realname.company}企业名称：{$realname.company}{/if} 
                   {/if}    
                  </p>
                
                <p style="margin-top:20px"><a class="layui-btn layui-btn-primary" href="{:url('@user/index/index')}" >返回主页</a></p>
            </div>
          
           {elseif $realname['status'] ==2}
            <div><p><i class="fa fa-times-circle fa-5x" aria-hidden="true" style="color:#FF5722"></i></p> <span>实名认证失败！</span>
              {if $realname.reason}<p class="layui-word-aux"> 原因：{$realname.reason}</p>{/if}
              <p class="layui-word-aux" style="margin-top:10px">
                  
                  {if $realname.type==1}
                  {if $realname.realname}真实姓名：{$realname.realname|}{/if}
                  {elseif   $realname.type==2}
                     {if $realname.realname}法人：{$realname.realname}{/if} &nbsp;
                     {if $realname.company}企业名称：{$realname.company}{/if} 
                  {/if}    
                 </p>
              <p style="margin-top:20px"><a class="layui-btn layui-btn-primary" href="{:url('@user/validate/realname',['reset'=>'1'])}" >重新认证</a></p>
            </div>   
           {/if}
      </div>
    
      {/if}


      </div>
    </div>
  </div>
  
  
</div>

<script>
    layui.use(['layer','form','laydate'], function(){
      var form = layui.form;
    
      var laydate = layui.laydate;
      
    
      form.on('submit(form1)', function(data){
    
        $.post('{:url("validate/realname")}',data.field,function(json){
              if(json.code ==0){
    
                 location.reload();
              }else{
                layer.msg(json.msg);
              }
        });
        return false;
      });
    
    
      laydate.render({
        elem: '#start_time'
      });
      laydate.render({
        elem: '#end_time' 
      });
    
      laydate.render({
        elem: '#company_start_time' 
      });
      laydate.render({
        elem: '#company_end_time' 
      });
    
      form.on('radio(type)', function(data){
      if(data.value ==1){
        $(".realname-title").html('真实姓名：');
        $(".card_number-title").html('证件号：');
         $("#company").hide();
      }else if(data.value==2){
         $("#company").show();
    
        $(".realname-title").html('企业法人：');
        $(".card_number-title").html('统一社会信用代码/注册号：');
      }
    
    });  
         
    });
    </script>
</body>
</html>